package com.yyb.exception;

import com.yyb.enums.ResultEnums;

/**
 * 描述: [自定义异常类]
 * 
 * 
 */
public class BusinessException extends RuntimeException{
    private Integer errCode= ResultEnums.ERROR.getCode();


    public BusinessException(ResultEnums resultEnums) {
        super(resultEnums.getMsg());
        this.errCode = resultEnums.getCode();
    }
    public BusinessException(ResultEnums resultEnums, Throwable throwable) {
        super(resultEnums.getMsg(), throwable);
        this.errCode = resultEnums.getCode();
    }

// 构造函数，用于创建BusinessException对象
    public BusinessException(Integer code, String msg) {
        // 调用父类的构造函数，传入msg参数
        super(msg);
        // 将传入的code参数赋值给errCode变量
        this.errCode = code;
    }

// 构造函数，用于创建一个BusinessException对象，并传入一个字符串参数msg
    public BusinessException(String msg) {
        // 调用父类Exception的构造函数，将msg作为参数传入
        super(msg);
    }

    public BusinessException(Throwable throwable) {
        super(throwable);
    }

    public Integer getErrCode() {
        return errCode;
    }

    public void setErrCode(Integer errCode) {
        this.errCode = errCode;
    }
}
